package com.itheima.d1_junit;

import org.junit.Assert;
import org.junit.Test;
/**
 * 测试类
 */
public class StringUtilTest {
    @Test
    public void testPrintNumble() {
        StringUtil.printNumble(null);
        StringUtil.printNumble("");
        StringUtil.printNumble("admin");
    }


    @Test
    public void testGetMaxIndex() {
        /*System.out.println(StringUtil.getMaxIndex(null));
        System.out.println(StringUtil.getMaxIndex(""));
        System.out.println(StringUtil.getMaxIndex("admin"));*/


        int i1 = StringUtil.getMaxIndex(null);
        Assert.assertEquals("null测试失败!",-1,i1);

        int i2 = StringUtil.getMaxIndex("");
        Assert.assertEquals("空字符串测试失败!",-1,i2);

        int i3 = StringUtil.getMaxIndex("admin");
        Assert.assertEquals("admin测试失败",4,i3);

        System.out.println("测试通过！！！");
    }
}